/*
** Copyright (C) 2010 Calin Radoni
**
** This file is part of CHScanner.
**
** CHScanner is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** CHScanner is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with CHScanner. If not, see <http://www.gnu.org/licenses/>.
*/

#include "StdAfx.h"
#include "MIPRangeCountry.h"

//---------------------------------------------------------------------------

MIPRangeCountry::MIPRangeCountry(void)
{
	Initialize();
}

MIPRangeCountry::MIPRangeCountry(const MIPRangeCountry &elemIn)
{
	xIpStart    = elemIn.xIpStart;
	xIpEnd      = elemIn.xIpEnd;
	xCountry[0] = elemIn.xCountry[0];
	xCountry[1] = elemIn.xCountry[1];
	xCountry[2] = 0;
}

MIPRangeCountry::~MIPRangeCountry(void)
{
}

//---------------------------------------------------------------------------

MIPRangeCountry& MIPRangeCountry::operator=(const MIPRangeCountry &elemIn)
{
	xIpStart    = elemIn.xIpStart;
	xIpEnd      = elemIn.xIpEnd;
	xCountry[0] = elemIn.xCountry[0];
	xCountry[1] = elemIn.xCountry[1];
	xCountry[2] = 0;
	return *this;
}

bool MIPRangeCountry::operator<(const MIPRangeCountry &elemIn)
{
	return xIpStart < elemIn.xIpStart ? true : false;
}

bool MIPRangeCountry::operator>(const MIPRangeCountry &elemIn)
{
	return xIpStart > elemIn.xIpStart ? true : false;
}

//---------------------------------------------------------------------------

void MIPRangeCountry::Initialize(void)
{
	xIpStart = 0;
	xIpEnd   = 0;
	xCountry[0] = xCountry[1] = xCountry[2] = 0;
}

void MIPRangeCountry::LoadFromPointer(MIPRangeCountry *elemIn)
{
	if(elemIn==NULL){
		Initialize();
		return;
	}

	xIpStart    = elemIn->xIpStart;
	xIpEnd      = elemIn->xIpEnd;
	xCountry[0] = elemIn->xCountry[0];
	xCountry[1] = elemIn->xCountry[1];
	xCountry[2] = 0;
}

//---------------------------------------------------------------------------
